//
//  DoPhotoCell.m
//  DoImagePickerController
//
//  Created by Donobono on 2014. 1. 23..
//

#import "DoPhotoCell.h"

@interface DoPhotoCell ()
{
    UIImageView *_ivPhoto;
    UIView  *_vSelect;
}

@end

@implementation DoPhotoCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.frame = CGRectMake(0, 0, 104, 104);
        
        self.contentView.frame = self.bounds;
        
        self.autoresizesSubviews = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
        
        _ivPhoto = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
        _ivPhoto.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        [self.contentView addSubview:_ivPhoto];
        
        _vSelect = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"imagepicker_selected.png"]];
        _vSelect.frame = CGRectMake(70,70,24,24);
        _vSelect.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
        [self.contentView addSubview:_vSelect];
    }
    return self;
}

- (void)dealloc
{
    [_ivPhoto release_mm];
    [_vSelect release_mm];
    superdealloc_mm;
}

- (void)setIvPhotoImage:(UIImage *)ivPhotoImage
{
    _ivPhoto.image = ivPhotoImage;
}

- (void)setSelectMode:(BOOL)bSelect
{
    if (bSelect)
    {
        _ivPhoto.alpha = 0.3;
        _vSelect.alpha = 1.0;
    }
    else
    {
        _ivPhoto.alpha = 1.0;
        _vSelect.alpha = 0.0;
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
